package com.cade.agriculturemall.view.personalCenter.discount;

import android.support.design.widget.TabLayout;
import android.support.v4.view.ViewPager;
import android.os.Bundle;

import com.cade.agriculturemall.R;
import com.cade.agriculturemall.base.BaseActivity;
import com.cade.agriculturemall.base.IBasePresenter;
import com.cade.agriculturemall.model.Ticket;

import java.util.List;

public class DiscountActivity extends BaseActivity {

    private TabLayout mTabLayout;
    private ViewPager mViewPager;
    private DiscountPagerAdapter mDiscountPagerAdapter;
    private List<Ticket> myDiscountList;
    private List<Ticket> storeList;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_discount);
        setupToolbar(true);
    }

    @Override
    public void setupView() {
        mTabLayout = (TabLayout) findViewById(R.id.discount_tabLayout);
        mViewPager = (ViewPager) findViewById(R.id.discount_viewPager);
        mDiscountPagerAdapter = new DiscountPagerAdapter(getSupportFragmentManager());
        mViewPager.setAdapter(mDiscountPagerAdapter);
        mTabLayout.setupWithViewPager(mViewPager);
        mDiscountPagerAdapter.notifyDataSetChanged();
        mViewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
            @Override
            public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {

            }

            @Override
            public void onPageSelected(int position) {
                mDiscountPagerAdapter.getItem(position).onResume();
            }

            @Override
            public void onPageScrollStateChanged(int state) {

            }
        });
    }

    @Override
    public void setupEvent() {
    }

    @Override
    public void setupData() {

    }

    @Override
    public IBasePresenter setupPresenter() {
        return null;
    }

}
